
package com.rollway.restful;

import org.springframework.http.HttpMethod;

import java.io.Serializable;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.LinkedHashMap;
import java.util.Map;

public final class MethodMetadata implements Serializable {

    private static final long serialVersionUID = 1L;
    private String serviceName;
    private String methodKey;
    private transient Type returnType;
    private Integer bodyIndex;
    private String bodyName;
    private Integer headerMapIndex;
    private Integer queryMapIndex;
    private final Map<Integer, String> pathIndexAndName = new LinkedHashMap<>();
    private final Map<Integer, String> queryIndexAndName = new LinkedHashMap<>();
    private final Map<Integer, String> headerIndexAndName = new LinkedHashMap<>();
    private final Map<String, String> headers = new LinkedHashMap<>();
    private transient Class<?> targetType;
    private transient Method method;
    private HttpMethod httpMethod;
    private Class<? extends RequestCustomizer>[] classes;

    public MethodMetadata() {
    }

    public String getServiceName() {
        return serviceName;
    }

    public String getMethodKey() {
        return methodKey;
    }

    public Type getReturnType() {
        return returnType;
    }

    public Integer getBodyIndex() {
        return bodyIndex;
    }

    public Integer getHeaderMapIndex() {
        return headerMapIndex;
    }

    public Integer getQueryMapIndex() {
        return queryMapIndex;
    }

    public Map<Integer, String> getPathIndexAndName() {
        return pathIndexAndName;
    }

    public Map<Integer, String> getQueryIndexAndName() {
        return queryIndexAndName;
    }

    public Map<Integer, String> getHeaderIndexAndName() {
        return headerIndexAndName;
    }

    public Map<String, String> getHeaders() {
        return headers;
    }

    public Class<?> getTargetType() {
        return targetType;
    }

    public Method getMethod() {
        return method;
    }

    public HttpMethod getHttpMethod() {
        return httpMethod;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public void setMethodKey(String methodKey) {
        this.methodKey = methodKey;
    }

    public void setReturnType(Type returnType) {
        this.returnType = returnType;
    }

    public void setBodyIndex(Integer bodyIndex) {
        this.bodyIndex = bodyIndex;
    }

    public void setHeaderMapIndex(Integer headerMapIndex) {
        this.headerMapIndex = headerMapIndex;
    }

    public void setQueryMapIndex(Integer queryMapIndex) {
        this.queryMapIndex = queryMapIndex;
    }

    public void setTargetType(Class<?> targetType) {
        this.targetType = targetType;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public void setHttpMethod(HttpMethod httpMethod) {
        this.httpMethod = httpMethod;
    }

    public void setBodyName(String bodyName) {
        this.bodyName = bodyName;
    }

    public String getBodyName() {
        return bodyName;
    }
}
